<?php
#############################################################################
# Diverse configuration parameters and constants used in this plugin.       #
#                                                                           #
# Author: consros 2010                                                      #
#############################################################################

# detection of used browser: normal or PCH-specific one
define("EMBEDDED_BROWSER", 
    FALSE !== strpos($_SERVER['HTTP_USER_AGENT'], 'Realtek'));

# home url since only absolute urls are allowed
define("HOME_URL", "http://" . $_SERVER['SERVER_ADDR'] . 
    dirname($_SERVER['SCRIPT_NAME']) . "/");

# templates
# define("TEMPLATE_DIR", EMBEDDED_BROWSER ? 
#    "templates/rss-default/" : "templates/debug/");
define("TEMPLATE_DIR", "templates/rss-default/");

define("TPL_CATEGORY_PAGE", TEMPLATE_DIR . "category_page.xml");
define("TPL_CATEGORY_ITEM", TEMPLATE_DIR . "category_item.xml");

define("TPL_CHANNEL_PAGE",  TEMPLATE_DIR . "channel_page.xml");
define("TPL_CHANNEL_ITEM",  TEMPLATE_DIR . "channel_item.xml");
define("TPL_CHANNEL_MENU",  TEMPLATE_DIR . "channel_menu.xml");

define("TPL_EPG_PAGE",      TEMPLATE_DIR . "epg_page.xml");
define("TPL_EPG_ITEM",      TEMPLATE_DIR . "epg_item.xml");


# set right timezone
date_default_timezone_set('Europe/Berlin'); 

# update system time via NTP if it is before of 01.01.2010
if (time() < mktime(0, 0, 0, 1, 1, 2010)) {
	$ntpServ = "ntps1-0.uni-erlangen.de";
	system("rdate -s $ntpServ && hwclock -w");
}

# now time can be calculated using UTC time and time zone
define("NOW_TIME", time());

# start session in order to gain access to session variables
session_start();
?>
